﻿#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;

class PersonMove
{
	friend ostream& operator<<(ostream& cout, PersonMove& p1);
public:
	PersonMove() {}
	PersonMove(int a, int b)
	{
		this->m_A = a;
		this->m_B = b;
	}

	//1.重载左移运算符不可以写到成员函数中；
	/*void operator<<()
	{

	}*/

	/*int m_A;
	int m_B;*/
private:
	int m_A;
	int m_B;
};
//2.第一个参数cout，第二个参数p1；
//void operator<<(ostream& cout, PersonMove& p1)
ostream& operator<<(ostream& cout, PersonMove& p1)
{
	//cout << "m_A= " << p1.m_A << "  m_B= " << p1.m_B << endl;
	cout << "m_A= " << p1.m_A << "  m_B= " << p1.m_B;
	return cout;
}
void testMove()
{
	PersonMove p1(10, 10);
	//cout << p1 << endl;
	//p1 << ...


	//cout << p1; //m_A= 10  m_B= 10
	//cout << p1; //m_A = 10  m_B = 10请按任意键继续. . .
	cout << p1 << endl; //m_A = 10  m_B = 10
	cout << p1 << " helloworld" << endl; //m_A= 10  m_B= 10 helloworld
}

//main278：左移运算符重载
int main278()
{
	testMove();

	system("pause");
	return EXIT_SUCCESS;
}